home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / sphigs / sph_dos.lha / dos / sphsrc / sph_pdc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-26  |  1.7 KB  |  58 lines

  1. #include "HEADERS.h"
  2. /**********************
  3.                       *
  4.  File                 * gen_pdc_verts.c
  5.                       * calculates pdc points from npc vertices
  6.                       *
  7.                       * changes pdc points
  8.                       * assumes map_to_canon was called before
  9.               *
  10.                       *********************************************************/
  11.  
  12. /**********************
  13.                       *
  14.  Includes          *
  15.                       *
  16.                       *********************************************************/
  17.  
  18. #include <stdio.h>
  19. #include "sphigslocal.h"
  20. #include <assert.h>
  21.  
  22. /**********************
  23.                       *
  24.  Function          * generate_pdc_vertices
  25.                       *
  26.                       * calculates the pdc points from the npc vertices
  27.               *
  28.                       *********************************************************/
  29. void  
  30. SPH__generate_pdc_vertices (view_spec *vs)
  31. {
  32.      MAT3hvec        result_vec;
  33.      MAT3hvec *        scanNPCvertex;
  34.      srgp__point *    scanPDCvertex;
  35.      MAT3vec        tempVertex;
  36.      int        count;
  37.  
  38.      scanNPCvertex = vs->npcVertices;
  39.  
  40.      if (vs->pdcVertices)
  41.       free (vs->pdcVertices);
  42.      
  43.      vs->pdcVertices = 
  44.     (srgp__point*) malloc (vs->vertexCount * sizeof(srgp__point));
  45.      assert( vs->pdcVertices != NULL );
  46.      
  47.      scanPDCvertex = vs->pdcVertices;
  48.      
  49.      for (count = 0; count < vs->vertexCount; count++) {
  50.       tempVertex[0] = (* scanNPCvertex)[0] * SPH_ndcSpaceSizeInPixels;
  51.       tempVertex[1] = (* scanNPCvertex)[1] * SPH_ndcSpaceSizeInPixels;
  52.       scanPDCvertex->x = irint( tempVertex[0] );
  53.       scanPDCvertex->y = irint( tempVertex[1] );
  54.       scanPDCvertex++;
  55.       scanNPCvertex++;
  56.      }
  57. }
  58.